<template>
  <ul class="todo-list">
    <!-- completed: 完成的类名 -->
    <li :class="{completed: item.done}" v-for="item in showlist " :key="item.id">
      <div class="view">
        <input class="toggle" type="checkbox" v-model="item.done" />
        <label>{{item.task}}</label>
        <button class="destroy" @click="SET_ID(item.id)"></button>
      </div>
    </li>
  </ul>
  
</template>

<script>
import {mapMutations} from 'vuex'
import {mapGetters} from 'vuex'
export default {
  computed:{
    ...mapGetters(['showlist'])
  },
  methods:{
    ...mapMutations('list',[ 'SET_ID'])
    // del(id){
    //  this.$store.commit('list/SET_ID', id)
    // }
  }
}
</script>
